package com.jz;

import com.jz.model.UserVo;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * Created by Hasee on 2022-02-23.
 */
@RestController
@Slf4j
public class ProviderController {


    @GetMapping("provider")
    public String testProvider(@RequestParam("id") Integer id, @RequestParam("name")String name){

        return "hello  my name is provider!==8012"+id+name;
    }

    @GetMapping("feignProvider")
//    @HystrixCommand(fallbackMethod = "testFallBack")
    public String feignProvider()throws Exception{
        log.info("hello  my name is provider!==8012");
        throw new Exception();
//        return "hello  my name is provider!==8012";
    }
    @PostMapping("postProvider")
    public String postProvider(@RequestBody UserVo userVo){
        return "hello  my name is provider!==8012"+userVo.toString();
    }
    public String testFallBack(){
        return "网络开小差了，请稍后重试！";
    }
}
